import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
//import java.util.*;
    
public class CounterView extends JPanel implements ActionListener
{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JTextArea textArea = new JTextArea();
    DobbelsteenModel d;
    int[] intArray;
    
    
    
	public CounterView()
	{
	    //this.setLayout(new FlowLayout());
	    this.add(textArea);
	    intArray = new int[6];
	}
	
	public void actionPerformed( ActionEvent e )
	{
	    d = (DobbelsteenModel) e.getSource();
	    intArray[(d.getWaarde()-1)]++;
	
	    	
	    textArea.setText
	    	("Aantal keren gegooid" +
	    			"\n\r1: "+ intArray[0]+
	    			"\n\r2: "+ intArray[1]+
	    			"\n\r3: "+ intArray[2]+
	    			"\n\r4: "+ intArray[3]+
	    			"\n\r5: "+ intArray[4]+
	    			"\n\r6: "+ intArray[5]
	    	);
	}
	
	
	public Dimension getPreferredSize()
	{
	    return new Dimension(150,50);
	} 
}
